package net.lzzy.lxq.dao;

import net.lzzy.lxq.entities.UserDevice;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface UserDeviceMapper {

    @Select("select * from userdevice where userId=#{id}")
    UserDevice getUserDevice(@Param("id")String id);

    @Select("select * from userdevice")
    List<UserDevice> getUserDevices();

    @Select("select * from userdevice where deviceId=#{id}")
    UserDevice getUserDeviceByDeviceId(@Param("id")String id);

    /*@Update("update userdevice set deviceid=#{deviceId} where userId=#{userId}")
    void bindDevice(@Param("deviceId")String deviceId,@Param("userId")String userId);*/

    @Insert("insert into userdevice values(null,#{userId},#{deviceId})")
    void bindDevice(UserDevice userDevice);
}
